import request from '@/utils/request'

//  查询隐患类别列表
export function getDefectQuestionList(params) {
  return request({
    url: '/business/defect/defectQuestion/list',
    method: 'get',
    params
  })
}

//  获取隐患详情
export function getDefectQuestionInfoById(id) {
  return request({
    url: `/business/defect/defectQuestion/${id}`,
    method: 'get',
  })
}

//  提交问题隐患
export function startDefectQuestion(params) {
  return request({
    url: '/business/defect/defectQuestion/submitQuestion',
    method: 'get',
    params
  })
}

//  新增问题隐患
export function addDefectQuestion(data) {
  return request({
    url: '/business/defect/defectQuestion/add',
    method: 'post',
    data
  })
}

//  新增问题隐患并提交
export function submitDefectQuestion(data) {
  return request({
    url: '/business/defect/defectQuestion/addAndSubmit',
    method: 'post',
    data
  })
}

//  更新问题隐患
export function updateDefectQuestion(data) {
  return request({
    url: '/business/defect/defectQuestion/update',
    method: 'put',
    data
  })
}

//  更新问题隐患并提交
export function updateAndSubmitDefectQuestion(data) {
  return request({
    url: '/business/defect/defectQuestion/updateAndSubmit',
    method: 'put',
    data
  })
}

//  删除问题隐患
export function delDefectQuestion(ids) {
  return request({
    url: `/business/defect/defectQuestion/${ids}`,
    method: 'delete',
  })
}

//  撤销提交的隐患
export function revokeSubmit(params) {
  return request({
    url: `/business/defect/defectQuestion/revocation`,
    method: 'get',
    params
  })
}

//  查询审批隐患列表
export function queryWaitCheckQuestion(params) {
  return request({
    url: '/business/defect/defectQuestionCheck/queryWaitCheckQuestion',
    method: 'get',
    params
  })
}

//  审批隐患
export function checkDefectQuestion(url,data) {
  return request({
    url,
    method: 'post',
    data
  })
}
